package edu.ccut.saturn.studio.logic.model.saturn.logic;

import org.eclipse.draw2d.geometry.Point;

import edu.ccut.saturn.studio.logic.LogicMultiPageEditor;
import edu.ccut.saturn.studio.logic.model.Shape;
import edu.ccut.saturn.studio.logic.model.ShapesDiagram;
import edu.ccut.saturn.studio.logic.model.saturn.SaturnInformationNode;
import edu.ccut.saturn.studio.logic.model.saturn.action.SaturnInformationNodeInAction;

public class SaturnInformationNodeInLogic extends SaturnInformationNode {

	private static final long serialVersionUID = 1L;
	
	@Override
	public Shape cloneShape(Point mousePoint, Shape shape) {
		ShapesDiagram diagram = (ShapesDiagram)shape.getParent();
		if(diagram.getEditors() instanceof LogicMultiPageEditor){
			SaturnInformationNodeInLogic saturnStartNode = new SaturnInformationNodeInLogic();
			SaturnInformationNodeInLogic saturn = (SaturnInformationNodeInLogic)shape;
			saturnStartNode.setLocation(mousePoint);
			saturnStartNode.setName(saturn.getName());
			saturnStartNode.setDescription(saturn.getDescription());
			saturnStartNode.setParameters(saturn.getParameters());
			saturnStartNode.setId(saturn.getId());
			saturnStartNode.setNextId(saturn.getNextId());
			return saturnStartNode;
		}else{
			SaturnInformationNodeInAction saturnStartNode = new SaturnInformationNodeInAction();
			SaturnInformationNodeInLogic saturn = (SaturnInformationNodeInLogic)shape;
			saturnStartNode.setLocation(mousePoint);
			saturnStartNode.setName(saturn.getName());
			saturnStartNode.setDescription(saturn.getDescription());
			saturnStartNode.setParameters(saturn.getParameters());
			saturnStartNode.setId(saturn.getId());
			saturnStartNode.setNextId(saturn.getNextId());
			return saturnStartNode;
		}
	}
}
